package org.de.maeyer.unit;

/**
 * @author Peter De Maeyer
 */
public abstract class NonMultiplyingUnit extends AbstractUnit {

	@Override
	public double convertFrom(double value, Unit unit) {
		return ((AbstractUnit) unit).convertTo(value, this);
	}

	@Override
	double convertTo(double value, NonMultiplyingUnit unit) {
		if (!equals(unit)) {
			throw newArithmeticException(this, unit);
		}
		return value;
	}
}
